home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 3006 / 3006.xpi / chrome / dwhelper.jar / content / download-queue.xml < prev    next >
Extensible Markup Language  |  2010-01-15  |  4KB  |  150 lines

  1. <?xml version="1.0"?>
  2. <!-- *****************************************************************************
  3.  *            Copyright (c) 2006-2009 Michel Gutierrez. All Rights Reserved.
  4.  ****************************************************************************** -->
  5. <!DOCTYPE bindings SYSTEM "chrome://dwhelper/locale/dwhelper.dtd" >
  6.  
  7. <bindings xmlns="http://www.mozilla.org/xbl"
  8.     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  9.     xmlns:html="http://www.w3.org/1999/xhtml"
  10.     xmlns:xbl="http://www.mozilla.org/xbl">
  11.  
  12.     <binding id="DownloadQueue" extends="widgets.xml#widget">
  13.  
  14.         <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  15.             <vbox flex="1">
  16.                 <tree 
  17.                     anonid="xTree"
  18.                     id="dwhelper-download-queue"
  19.                     flex="1"
  20.                     enableColumnDrag="false" 
  21.                     hidecolumnpicker="true"
  22.                     flags="dont-build-content" 
  23.                     datasources="rdf:null" 
  24.                     ref="urn:root"
  25.                     >
  26.                     
  27.                     <treecols>
  28.                         <treecol 
  29.                             id="dwhelper-download-queue-col0"
  30.                             anonid="xCol0"
  31.                             xbl-persist="downloadqueue-col0:width,ordinal,hidden,sortActive,sortDirection"
  32.                             primary="true"
  33.                             flex="1"
  34.                             label="&column.file-name;"
  35.                             sort="?url"
  36.                             />
  37.                             
  38.                     </treecols>
  39.     
  40.                     <template>
  41.                         <rule>
  42.                             <conditions>
  43.                                 <content uri="?root"/>
  44.                                 <member container="?root" child="?entry"/>
  45.                                 <triple subject="?entry"
  46.                                      predicate="http://downloadhelper.net/1.0#status"
  47.                                      object="queued"/>
  48.                                 <triple subject="?entry"
  49.                                      predicate="http://downloadhelper.net/1.0#label"
  50.                                      object="?label"/>
  51.                             </conditions>
  52.                             <bindings>
  53.                               </bindings>
  54.                               <action>
  55.                                 <treechildren>
  56.                                     <treeitem
  57.                                         uri="?entry" open="true">
  58.                                         <treerow>
  59.                                             <treecell                
  60.                                                 label="?label"
  61.                                                 />
  62.                                         </treerow>
  63.                                     </treeitem>
  64.                                 </treechildren>
  65.                             </action>
  66.                         </rule>
  67.                     </template>
  68.     
  69.                 </tree>
  70.                 <hbox anonid="xButBox" hidden="true">
  71.                     <button anonid="xRemoveBut" label="&button.remove-downloads;" flex="1" 
  72.                         oncommand="this.parentXBL.remove()"/>
  73.                 </hbox>
  74.             </vbox>
  75.             <children style="display: none;"/>
  76.         </xbl:content>
  77.  
  78.         <implementation>
  79.  
  80.             <constructor>
  81.                 <![CDATA[
  82. this.dlMgr=Components.classes["@downloadhelper.net/download-manager;1"]
  83.     .getService(Components.interfaces.dhIDownloadMgr);
  84. this.util.setDatasource(this.xTree,this.dlMgr.queueDatasource);
  85. setTimeout(function(_this) { _this.doMonitorXBLPersist=true; },0,this);
  86.                 ]]>
  87.             </constructor>
  88.             
  89.             <method name="remove">
  90.                 <body>
  91.                 <![CDATA[
  92. var sel=this.getSelectedMedias();
  93. this.dlMgr.removeFromQueue(sel,sel.length);
  94.                 ]]>
  95.                 </body>
  96.             </method>
  97.             
  98.             <method name="getSelectedMedias">
  99.                 <body>
  100.                 <![CDATA[
  101. var sel=[];
  102. try {
  103.     if(this.xTree.view==null)
  104.         return sel;
  105.     if(this.xTree.view.selection.count<1)
  106.         return sel;
  107.     if(this.xTree.builderView==null)
  108.         return sel;
  109.     var numRanges = this.xTree.view.selection.getRangeCount();
  110.     for (var t=0; t<numRanges; t++){
  111.         var start={};
  112.         var end={};
  113.           this.xTree.view.selection.getRangeAt(t,start,end);
  114.           for (var v=start.value; v<=end.value; v++) {
  115.               if(v>=0) {
  116.                 var res=this.xTree.builderView.getResourceAtIndex(v);
  117.                 sel.push(res);
  118.             }
  119.         }
  120.     }
  121.     return sel;
  122. } catch(e) {
  123.     return [];
  124. }
  125.  
  126.                 ]]>
  127.                 </body>
  128.             </method>
  129.  
  130.                         
  131.         </implementation>
  132.         
  133.         <handlers>
  134.  
  135.             <handler event="select">
  136.                 <![CDATA[
  137. var entries=this.getSelectedMedias();
  138. if(entries.length==0)
  139.     this.xButBox.setAttribute("hidden","true");
  140. else
  141.     this.xButBox.setAttribute("hidden","false");
  142.                 ]]>
  143.             </handler>
  144.  
  145.         </handlers>
  146.                 
  147.     </binding>
  148.  
  149. </bindings>
  150.